<!doctype html>
<html>
<head>
	<meta charset="utf-8"><meta name="format-detection" content="telephone=no">
	<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
	<link rel="stylesheet" type="text/css" href="../../lib/css/skin.css"/>
</head>
<body>

<div id="root">
	<div class="app_warp">
		<div class="app_head">
			<span class="left back"></span>
			<span class="name">测试</span>
		</div>
		<div class="app_main">
			<div class="nocontent animated fadeInUp">
				<img src="../../lib/img/loading.gif" class="minimize" alt="">
				<div class="text minimize">
					测试
				</div>
			</div>
		</div>
	</div>
</div>

<script>
	var
		appready = function () {

			var path=api.pageParam.path,
				moviePlayer = api.require('moviePlayer'),
				testBack=function(){
					moviePlayer.isFullscreen(function(ret){
						if(ret.state===true){
							api.toast({
								msg:'请退出全屏幕模式后再次尝试返回。'
							})
							return false;
						}else{
							api.closeWin();
						}
					});
				};

			if(_$.getType(path)==='string'){

				api.setWinAttr({
					slidBackEnabled: false
				});
				api.addEventListener({
					name: 'keyback'
				}, function (ret, err) {
					testBack();
				});

				moviePlayer.addEventListener(function(ret){
					if(ret && ret.eventType == 'back'){
						testBack();
					}
					if(ret && ret.eventType == 'complete'){
						api.toast({
							msg:'课程播放完毕'
						})
						_$.sleep(function(){
							api.closeWin();
						},1500);
					}
					if(ret && ret.eventType == 'error'){
						api.toast({
							msg:'抱歉，视频播放异常，请稍后重试。'
						})
						_$.sleep(function(){
							api.closeWin();
						},1500);
					}
				});
				moviePlayer.open({
					rect: {
						x: 0,
						y: 0,
						w: api.winWidth,
						h: api.winHeight
					},
					styles: {
						head: {
							bg: 'rgba(0,0,0,0.5)',
							height: 50,
							y: api.safeArea.top,
							title: {
								size: 16,
								color: '#fff',
								width: 180,
								leftMargin: 44
							},
							backSize: 40,
							backImg: 'widget://widget/image/back.png'
						},
						foot: {
							bg: 'rgba(0,0,0,0.5)',
							height: 50,
							palyBtn: {
								size: 40,
								playImg: 'widget://widget/image/play.png',
								pauseImg: 'widget://widget/image/pause.png',
								marginLeft: 10
							},
							currentTimeLabel: {
								textSize: 14,
								textColor: "#FFF",
								textWidth: 50,
								marginLeft: 10
							},
							seekBar: {
								sliderW: 20,
								sliderH: 20,
								progressColor: '#696969',
								progressSelected: '#76EE00',
								marginLeft: 10,
								marginRight: 10
							},
							totalTimeLabel: {
								textSize: 14,
								textColor: "#FFF",
								textWidth: 50,
								marginRight: 5
							},
							fullscreenBtn: {
								size: 40,
								verticalImg:'widget://widget/image/vertical.png',
								horizontalImg:'widget://widget/image/horizontal.png'
							}
						}
					},
					path: path,
					autoPlay: true
				}, function (ret, err) {});
			}else{
				api.toast({
					msg:'视频地址异常，请稍后重试。'
				})
				_$.sleep(function(){
					api.closeWin();
				},1500);
			}
		}

</script>
<script src="../../lib/js/config.js"></script>
<script src="../../lib/js/data.js"></script>
<script src="../../lib/js/jquery.js"></script>
<script src="../../lib/js/common.js"></script>
</body>
</html>